Skip to content

fix(tools): migrate unit test runner from playwright to puppeteer#3121

Merged
bennypowers merged 7 commits intomainfrom
fix/puppeteer-unit-tests
May 1, 2026
Merged

fix(tools): migrate unit test runner from playwright to puppeteer#3121
bennypowers merged 7 commits intomainfrom
fix/puppeteer-unit-tests

Conversation

@bennypowers
Copy link
Copy Markdown
Member

Summary

  • Playwright 1.57.0 removed page.accessibility.snapshot(), which broke all a11y tree
    snapshot tests (321 uses across 57 test files)
  • Migrated from @web/test-runner-playwright to @web/test-runner-chrome + puppeteer,
    which still supports the accessibility snapshot API
  • All existing test assertions (axRole, axName, axContainRole, axTreeFocusOn, etc.)
    work identically with no test file changes

Breaking change

Downstream consumers of @patternfly/pfe-tools must update their dependencies:

  • Remove @web/test-runner-playwright
  • Add @web/test-runner-chrome and puppeteer

Test plan

  • Type-check passes (tsc --noEmit)
  • pf-select tests pass (160/160, heavy a11ySnapshot usage)
  • Failure count identical to main (pre-existing combobox/dropdown issues)
  • CI green

Playwright 1.57.0 removed `page.accessibility.snapshot()`, breaking
all a11y tree snapshot tests. Puppeteer still supports this API.

Replaced `@web/test-runner-playwright` with `@web/test-runner-chrome`
plus `puppeteer` in pfe-tools peer dependencies.

BREAKING CHANGE: downstream consumers must install `puppeteer` and
`@web/test-runner-chrome` instead of `@web/test-runner-playwright`.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2026

🦋 Changeset detected

Latest commit: 5febfeb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@patternfly/pfe-tools Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for patternfly-elements ready!

Name Link
🔨 Latest commit 0a156fb
😎 Deploy Preview https://deploy-preview-3121--patternfly-elements.netlify.app/

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

✅ Commitlint tests passed!

More Info
{
  "valid": true,
  "errors": [],
  "warnings": [],
  "input": "fix(tools): migrate unit test runner from playwright to puppeteer"
}

@github-actions github-actions Bot added the AT passed Automated testing has passed label Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for 164598f: Report

Replace raw snapshot property access (deep.equal, children?.find,
children?.filter) with ax helper assertions (axContainRole, axContainQuery,
axContainName, axTreeFocusedNode, querySnapshot, querySnapshotAll).

This makes tests resilient to snapshot format differences between
browser automation backends (Puppeteer includes extra properties like
backendNodeId, loaderId that Playwright did not).

Also fixes chai `.not` flag bleeding through `.and` chaining in
combobox-controller tests by splitting into separate expect() calls.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for b361b99: Report

@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for 41d0fef: Report

Puppeteer's Chrome requires --no-sandbox on GitHub Actions runners
where unprivileged user namespaces are restricted by AppArmor.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for 947e6dd: Report

The SSR test container used playwright v1.48.2 but the lockfile
resolved playwright v1.57.0, causing browser binary mismatches.

Aligns `@playwright/test` peerDep with `playwright` at ~1.57.0.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for 311092b: Report

Replace raw snapshot destructuring and role string comparisons
with ax helpers. Puppeteer uses 'StaticText' role instead of 'text',
and includes extra properties in snapshot nodes.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

SSR Test Run for bfa12a0: Report

- Set concurrency to 1: concurrent pages in same browser cause focus
  contention, making keyboard/mouse tests flaky. This affects both
  Playwright and Puppeteer.
- Add `press()` utility to pfe-tools that decomposes modifier key
  combos (e.g. Shift+Tab) for Puppeteer compatibility, since Puppeteer
  does not support combo key names in `keyboard.press()`.
- Fix accordion tests: replace `axTreeFocusOn(document.body)` with
  assertions that don't depend on page-level focus (Puppeteer can't
  Tab out of the page). Remove Shift+Tab-to-body tests that test
  browser chrome behavior, not component behavior.
- Fix search-input Tab test: assert listbox collapsed instead of
  checking page-level focus state.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Collaborator

@zeroedin zeroedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Landed Granular Tests Migration

@bennypowers bennypowers merged commit 74318a1 into main May 1, 2026
23 checks passed
@bennypowers bennypowers deleted the fix/puppeteer-unit-tests branch May 1, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AT passed Automated testing has passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants